package com.sun.service.impl;

import com.sun.pojo.User;
import com.sun.pojo.UserDTO;
import com.sun.mapper.UserMapper;
import com.sun.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author SunRui
 * @description UserService 实现类
 * @date 2024/10/3 20:40
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public int add(User user) {
        System.out.println("新增操作");
        return userMapper.addUser(user);
    }

    @Override
    public int delete(int id) {
        System.out.println("删除操作");
        return userMapper.delete(id);
    }

    @Override
    public int update(User user) {
        System.out.println("修改操作");
        return userMapper.update(user);
    }

    @Override
    public List<UserDTO> select() {
        System.out.println("查询操作");
        return userMapper.select();
    }
}
